package com.controller;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.model.auto.ArticleInfo;
import com.service.IArticleInfoService;
import com.util.Page;
import com.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 政策文章信息表 前端控制器
 * </p>
 *
 * @author astupidcoder
 * @since 2022-09-14
 */
@RestController
@RequestMapping("/articleInfo")
public class ArticleInfoController{
    @Autowired
    private IArticleInfoService articleInfoService;

    //获取政策信息
    @GetMapping("/getzc")
    public R getzc(Page page, String title, String type) {
        return articleInfoService.getzc(page, title, type);
    }

    /**
     * 阅读文章
     * @param id
     * @return
     */
    @GetMapping("/read")
    public R read(Integer id) {
        return articleInfoService.read(id);
    }

    /**
     * 获取关注更多
     * @param title
     * @param type
     * @param followType
     * @return
     */
    @GetMapping("/getFollow")
    public R getFollow(String title, String type, Integer followType) {
        return articleInfoService.getFollow(title, type, followType);
    }

    @GetMapping("/detail" )
    public R detail(Integer id) {
        ArticleInfo articleInfo = articleInfoService.getById(id);
        return R.ok(articleInfo);
    }
}
